import 'package:flutter/material.dart';
import 'package:todo_list/components/base/neu_box.dart';

class HomeBody extends StatefulWidget {

  const HomeBody({Key? key}) : super(key: key);

  final List<Widget> list = [];

  @override
  State<HomeBody> createState() => _HomeBodyState();
}

class _HomeBodyState extends State<HomeBody> {
  @override
  Widget build(BuildContext context) {
    return SizedBox(
      width: MediaQuery.of(context).size.width,
      height: MediaQuery.of(context).size.height,
      child: Stack(
        children: [
          ListView.builder(
            itemCount: 30,
            itemBuilder: (context, index) => ListItem(),
          ),
          Positioned(
            right: 30,
            bottom: 30,
            child: AddButton(
              onClick: () {
                print("添加");
              },
            ),
          ),
        ],
      ),
    );
  }
}

class AddButton extends StatelessWidget {
  final GestureTapCallback onClick;

  const AddButton({Key? key, required this.onClick}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: onClick,
      child: const NeuBox(
        padding: EdgeInsets.all(12),
        borderRadiusSize: 30,
        child: Icon(
          Icons.add,
          color: Colors.white,
        ),
      ),
    );
  }
}

class ListItem extends StatelessWidget {
  const ListItem({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container();
  }
}
